1. Field of the Invention
The present invention is directed to the field of managing memory use in run time environments in interpreted programming language environments. In particular, the invention provides a structure for a file of one or more Java(trademark)1 classes that can be stored and accessed at runtime from non-volatile memory such as read only memory (ROM).
1Java is a trademark of Sun Microsystems, Inc. 
2. Description of the Related Art
Portable devices, including cellular telephones, pagers and personal digital assistants (PDAs), are operated by embedded processing systems. Similar embedded systems are used in other types of devices, including automotive navigational systems found in the new generation of so called xe2x80x9csmartxe2x80x9d cars and household electrical management systems for remotely controlling home lighting, alarm and other systems.
A feature of embedded systems, particularly in portable devices, is that the memory available is constrained, generally of the order of one to four megabytes. Further, the memory of a system is a subdivided between read only memory (ROM) which can hold permanent data from which the volatile elements are constructed or instantiated in random access memory (RAM) at runtime. The ROM and RAM are fixed during manufacture of the device, although they may be augmented to a limited extent by the addition of PCMCIA cards.
Because of these memory constraints, embedded systems do not contain layers of software between a running application and the hardware components typically found in larger systems. Many embedded applications are designed to run on thin realtime operating systems or with only some interface code (a memory manager and graphics driver) directly on the hardware.
Interpreted language environments, such as Java and Smalltalk, make good runtime operating systems. Typically, the code is stored in ROM in a semi-processed state, class files containing byte codes. When the device is turned on, a virtual machine (VM) resolves references and links the class file to permit desired applications to be run.
One problem with the conventional approach is that the copying of all runtime code to RAM reduces the amount of RAM available for application use. In an environment in which there are limitations on total memory, the assignment of increasingly large portions to RAM reduces the amount of RAM available for application use.
A more general problem is that the time it takes to translate the semi-processed class files to a runtime state delays start up of applications in the device when powering on.
It is therefore an object of the present invention to provide a means for a directly accessing data stored in ROM in order to be able to maximize the amount of memory available in devices, particularly those with constrained resources.
The invention provides the structure of the portion of data stored in ROM that permits it to be accessed at run time. This is accomplished by prelinking data elements and writing them to files that are stored in ROM. These files are then directly accessible in ROM by the virtual machine at run time.
The invention also provides a process for designing in advance those portions of an application that will change and those that won""t, and building the application so that the portions that will not change are accessible directly from ROM at runtime.
One advantage of providing ROM-accessible files is that the RAM requirements for running applications can be reduced. More RAM memory, in a constrained memory environment, is available, thereby permitting more and/or more complex applications to be run on the device at the same time.
In maximizing ROM usage, a further object of the invention is to avoid sacrificing performance due to excessive indirection.
Another advantage realized by prelinking or prereferencing the .class files is that run time files are immediately available from ROM on powering up a device, effectively providing xe2x80x9cinstant onxe2x80x9d capability.
According to these and other objects, the present invention provides a system for use in an interpreted programming environment, in which files are pre-processed to a semi-processed state for linking and execution by a virtual machine at runtime on a target device. The improvement of the invention is a builder which is adapted to analyze the semi-processed files to select data that will not change, and to construct files to be run by the virtual machine from read-only memory on the target device including the selected data and internal pointers from the selected data.
The present invention also provides a data file adapted to be accessed by a virtual machine from read-only memory at runtime. The data file consists of class definitions and byte code data required to run an application, and internal pointers pre-linking the data.
Finally, the invention provides a method for constructing a memory image file for storage in read-only memory of a target device. A maximal set of objects is defined for inclusion in the image file. The maximal set of objects is reduced to remove unused code. Each object of the reduced maximal set is converted to image format, and each image format is written to the memory image file.